package com.ct.service.status;

public class TravelApprovalContext {
    private ApprovalState state;

    public TravelApprovalContext() {
        this.state = new UnprocessedState();
    }

    public void setState(ApprovalState state) {
        this.state = state;
    }

    public int getType() {
        return state.getType();
    }

    public String getDesc() {
        return state.getDesc();
    }

    public static ApprovalState getByType(Integer type) {
        switch (type) {
            case 0:
                return new UnprocessedState();
            case 1:
                return new ApprovedState();
            case 2:
                return new RejectedState();
            default:
                return null;
        }
    }
}